#INCLUDE "PROTHEUS.CH"
#INCLUDE "APWEBEX.CH"
/*/{Protheus.doc} DTRWEB03

@descricao GERACAO DE OS

@author Peterson Scherwinski

@since 11/07/2014

/*/
User Function DTRWEB03
	Local cHtml	:= ""
	local oObj
	local cPagina	:= "DTRHTM04"//pagina a ser apresentada

	Web Extended Init cHtml// START "init"
		//controle de acesso / timeout
		if type("HTTPSESSION->USERLOGIN") <> "A"
			HTTPSESSION->ALERT	:= "Necessario efetuar o login."
			RETURN( RedirPage('/U_DTRWEB01.apw'))
		endif
	
		HTTPSESSION->ALERT		:= ""
		HTTPSESSION->SUCESSO		:= .F.
		HTTPSESSION->SCHEDULE	:= {"","","","","","","","","","","",HTTPSESSION->AGENDAS[val(HTTPGET->ID)][2],"","",0}
		
		if !empty(HTTPGET->ID) .and. !empty(HTTPGET->CALENDAR) .and. !empty(HTTPGET->TASK)
			HTTPSESSION->SCHEDULE := {;
				HTTPGET->resourse/*1 COD recurso*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][1]/*2 data*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][2]/*3 projeto*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][3]/*4 tarefa*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][4]/*5 hr ini*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][5]/*6 hr fim*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][6]/*7 desc prj*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][11]/*8 TEXTO DA OS*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][12]/*9 ALMOCO*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][13]/*10 KM*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][14]/*11 OBS DESP*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][2]/*12 NOME CONSULTOR*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][8]/*13 desc Tarefa*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][9]/*14 recno*/,;
				HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][15]/*15 outros descontos*/}
				if HTTPSESSION->AGENDAS[val(HTTPGET->ID)][3][val(HTTPGET->CALENDAR)][val(HTTPGET->TASK)][10] == "S"
					HTTPSESSION->ALERT		:= "Ordem de Servico gerada anteriormente."
					HTTPSESSION->SUCESSO		:= .T.
				endif
		ENDIF

	//HTML GERAR OS
	execInPage(cPagina)
	
	Web Extended End

return(cHtml)
